﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="format-detection" content="telephone=no">

    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon"
          href="images/GalacticIcon.png" />
    <link rel="apple-touch-icon-precomposed"
          href="images/GalacticIcon.png" />

    <title>Galactic</title>

    <link rel="icon" type="image/png" href="images/GalacticIcon.png" />

    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
    <link rel='stylesheet' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/cupertino/jquery-ui.min.css' />
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet">
    <script src="js/lib.js"></script>
    <script src="js/md5.js"></script>
    <script src="js/jgrowl.min.js"></script>
    <link href="css/styles.css" rel="stylesheet" />
    <link href="css/jGrowl.css" rel="stylesheet" />
    <script src="js/jCanvas.min.js"></script>
    <script src="js/flot/jquery.flot.min.js"></script>

    <script src="js/flot/jquery.flot.resize.min.js"></script>
    <script src="js/flot/jquery.flot.symbol.min.js"></script>
    <script src="js/flot/jquery.flot.navigate.min.js"></script>
    <script src="js/flot/jquery.flot.axislabels.js"></script>

    
    <link rel="stylesheet" type="text/css" href="css/m.css" media="screen, handheld" />
        

    <link rel="stylesheet" type="text/css" href="css/styles.css"/>
    <!--[if (lt IE 9)&(!IEMobile)]>
    <link rel="stylesheet" type="text/css" href="enhanced.css" />
    <![endif]-->


    <script type="text/javascript">
        _mobile = true;
        _PendingRunsInterval = null;
        $(document).ready(function ()
        {
            
            $("nav.side article").click(NavClick);

            IsHtml5NotificationOk();

            RefreshPendingRuns();

            NavClick("home.htm");

            
           

        });

        function InitPendingRunsInterval()
        {
            _PendingRunsInterval = setInterval(RefreshPendingRuns, 1000 * 60);
        }

        function NavClick(url)
        {
          
            var a = $(this);
            if (typeof url != "string")
                url = a.data("nav");


            if (typeof PageCleanup == "function") {
                PageCleanup();
                PageCleanup = null;
            }

            $("#contentpane").load(url,
                function () {
                    // $("nav.side").hide();
                    prepButtons();
                    prepHeightToggles();

                });
        }

        function ToggleSideNav(show, event)
        {
            event.preventDefault();
            event.stopPropagation();
            if(show)
            {
         
                $("nav.side").one("click", function (event) {
       
              
                    $("nav.side").hide("slide");
                });

                $("nav.side").show("slide");
            }
            else
            {
                $("nav.side").hide("slide");
            }
           
        }

        var _LastPendingRunCount = 0;
        function RefreshPendingRuns(manual)
        {
            if (typeof manual != "undefined" && manual)
                $("#PendingRunsNav").hide();

            GetJsonSproc("usp_GetPendingRunsCount", {},
            function(json)
            {
                var c = json[0].Count;

                
                $("#PendingRunsNav").text(c).show().addClass("red");
                setTimeout(function () { $("#PendingRunsNav").removeClass("red") }, 2000);

                if (c > 0 && _LastPendingRunCount == 0)
                {
                    InitPendingRunsInterval();
                }

                if (c == 0 && _LastPendingRunCount > 0)
                {                  
                    Html5Notification('Data Run Queue Empty', "All Data Runs Complete!");
                    clearInterval(_PendingRunsInterval);
                    _PendingRunsInterval = null;
                }
                
                _LastPendingRunCount = c;

            });
        }

        //html5 notifications. tested in Chrome 36 and FireFox 31 on Windows 8.1 32bit
        var __Html5NotificationOk;
        // use function to cache a single bool to make faster.
        function IsHtml5NotificationOk()
        {
            // is capable?
            if (! "Notification" in window) {
                __Html5NotificationOk = false;
                return false;
            }

            //request permissions
            if (Notification.permission === "granted")

            {
                __Html5NotificationOk = true;
                return true;
            }

            if (Notification.permission !== "denied")
            {
                Notification.requestPermission(function (permission) {
                    __Html5NotificationOk = permission === "granted";
                });
                
            }
            else
                __Html5NotificationOk = false;
        }


        function Html5Notification(title, body)
        {
           
            if(__Html5NotificationOk)
            {
                var n = new Notification(title,
                    {
                        icon: "images/Galacticicon.png",
                        lang: "en-US",
                        body: body
                    });
            }
          

        }




    

    </script>

</head>
<body>

    <div id="NotifyDiv" class="ui-widget-header ui-state-highlight ui-corner-all">dfdf</div>

    <section class="content">
        
       
        <section>
   
            <nav class="side ui-widget-content ui-corner-all" style="position:fixed;">
                <article data-nav="home.htm"><i class="fa fa-home fa-fw"></i>Home</article>
                <article data-nav="visualize.htm"><i class="fa fa-bar-chart-o fa-fw"></i>Visualize</article>
                <article data-nav="DatasetPlot.htm"><i class="fa fa-bar-chart-o fa-fw"></i>Plot</article>
                <article data-nav="AddDataSet.htm"><i class="fa fa-plus fa-fw"></i>Data Set</article>
                <article data-nav="MorphologyFilters.htm"><i class="fa fa-filter fa-fw"></i>MorphologyFilters</article>
                
                <article data-nav="adddatarun.htm"><i class="fa fa-cloud fa-fw"></i>Queue Data Run</article>
                <article data-nav="kstest.htm"><i class="fa fa-table fa-fw"></i>K-S Tests</article>
                <article data-nav="bulkdatarequest.htm"><i class="fa fa-table fa-fw"></i>Bulk Data Request</article>
                <article data-nav="trackprogress.htm"><i class="fa fa-table fa-fw"></i>Track Progress</article>
                <article data-nav="CompletedData.htm"><i class="fa fa-table fa-fw"></i>Completed Data</article>


                <article data-nav="ui-client.htm"><i class="fa fa-download fa-fw"></i>Client</article>

                <article data-nav="CreateAccount.htm" class="loginrequired"><i class="fa fa-user fa-fw"></i>Create Account</article>
                <article data-nave="test.htm"><i class="fa fa-check fa-fw"></i>Test(Dev)</article>
                       

              
                <article onclick="document.location='desktop.htm'"><i class="fa fa-desktop fa-fw"></i>Desktop</article>
                <article onclick="Logout();"><i class="fa fa-fw fa-unlock"></i>Logout</article>
            </nav>
        
        </section>
        
        <section>
        
            <nav class="top ui-widget-header">
            <img src="images/GalacticIcon.png" width="30" onclick="ToggleSideNav(true, event);" />
                Galactic v0.2

                <span class="runsinqueue" onclick="RefreshPendingRuns();"><span id="PendingRunsNav">0</span> Runs In Queue</span>
    
            </nav>

       

            <section id="contentpane">

                content

            </section>

        </section>

      

    </section>

 

</body>
</html>
